package com.ywb.ex05;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * @Author ywb
 */
public class Task3 {
    public static void main(String[] args) throws UnknownHostException {
        String localHost = InetAddress.getLocalHost().toString();
        String[] localHosts = localHost.split("/");
        System.out.println("本地主机名:" + localHosts[0]);
        System.out.println("本地IP地址:" + localHosts[1]);
    }
}
